﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Microsoft.Practices.Unity;

namespace CoderJoe.WoW.GearManager.Views
{
    /// <summary>
    /// Interaction logic for CharacterView.xaml
    /// </summary>
    public partial class CharacterView : UserControl
    {
		[Dependency]
		public CharacterModel Model
		{
			get { return (CharacterModel)this.DataContext; }
			set { this.DataContext = value; }
		}

		[Dependency]
		internal CharacterController Controller
		{
			get;
			set;
		}

        public CharacterView()
        {
            InitializeComponent();
        }

        private void Grid_Loaded(object sender, RoutedEventArgs e)
        {
            if (App.CurrentWorkspace != null)
            {
                Grid grid = (Grid)sender;
                foreach (EquipmentButton button in grid.Children.OfType<EquipmentButton>())
                {
                    App.CurrentWorkspace.BuildUp(button);
                }
            }
        }
    }
}
